{extend name="base" /}
{block name="body"}
<script src="__JS__/layui/layui.all.js"></script>
<style>
  .filesss {
    position: relative;
    display: inline-block;
    background: #D0EEFF;
    border: 1px solid #99D3F5;
    border-radius: 4px;
    padding: 15px 10px;
    overflow: hidden;
    color: #1E88C7;
    text-decoration: none;
    text-indent: 0;
    line-height: 0px;
  }

  .filesss input {
    position: absolute;
    font-size: 100px;
    right: 0;
    top: 0;
    opacity: 0;
  }

  .filesss:hover {
    background: #AADFFD;
    border-color: #78C3F3;
    color: #004974;
    text-decoration: none;
  }

  .a-uploadss {
    position: relative;
    display: inline-block;
    background: #D0EEFF;
    border: 1px solid #99D3F5;
    border-radius: 4px;
    padding: 15px 10px;
    overflow: hidden;
    color: #1E88C7;
    text-decoration: none;
    text-indent: 0;
    line-height: 0px;
  }

  .redirectTozhibo {
    position: relative;
    display: inline-block;
    background: #D0EEFF;
    border: 1px solid #99D3F5;
    border-radius: 4px;
    padding: 15px 10px;
    overflow: hidden;
    color: #1E88C7;
    text-decoration: none;
    text-indent: 0;
    line-height: 0px;
  }

  .a-uploadss input {
    position: absolute;
    font-size: 100px;
    right: 0;
    top: 0;
    opacity: 0;
  }

  .a-uploadss:hover {
    background: #AADFFD;
    border-color: #78C3F3;
    color: #004974;
    text-decoration: none;
  }
</style>
<script>

</script>
<div class="layui-body">
  <!--tab标签-->
  <div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title">
      <li class="layui-this">老师</li>
      <li class=""><a href="{:url('admin/admin/add')}">添加老师</a></li>
    </ul>
    <div class="layui-tab-content">


      <form action="{:url('admin/admin/upload')}" enctype="multipart/form-data" method="post">
        <a href="javascript:;" class="filesss">选择Excel文件
          <input type="file" name="teachers"/>
        </a>
        <span class="showFileName"></span>
        <a href="javascript:;" class="a-uploadss">批量导入教师
          <input type="submit" value="批量导入教师"/>
        </a>

        <a style="float: right" onclick="redirectTo()" href="#"
           class="redirectTozhibo">跳转直播平台
        </a>
      </form>


      <table class="layui-table">
        <thead>
        <tr>
          <th style="width: 30px;">ID</th>
          <th>用户名</th>
          <th>角色</th>
          <th>性别</th>
          <th>联系方式</th>
          <th>昵称</th>
          <th>创建时间</th>
          <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {if condition="isset($admin_user_list) and !empty($admin_user_list)"}
        {foreach name="admin_user_list" item="vo"}
        <tr>
          <td>{$vo.id}</td>
          <td>{$vo.userLoginName}</td>
          <td>{if condition="$vo.usertype == 2"} 教师 {else/}学生 {/if}</td>

          <td>{if condition="$vo.male == 'false'"} 女 {else/}男 {/if}</td>
          <td>{$vo.phone}</td>
          <td>{$vo.nickName}</td>
          <td>{$vo.create_time}</td>
          <td>
            <!--<a href="{:url('admin/admin/delete',['id'=>$vo.id])}"-->
            <!--class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>-->
          </td>
        </tr>
        {/foreach}
        {else/}
        <tr>
          <td colspan="8">暂无数据</td>
        </tr>
        {/if}
        </tbody>
      </table>
      {$page|raw}
    </div>
  </div>
</div>


<form method="post" action="http://rykj.gensee.com/training/site/login" id="form1" style="display: none">
  <input type="hidden" name="redirectUrl" value="">
  <input type="hidden" name="errorUrl" value="">
  <input type="text" id="nameInput" name="name" value="">
  <input id="passwordInput" type="password" name="password" value="">
</form>


</div>
<script>

  $(".filesss").on("change", "input[type='file']", function(){

    var filePath = $(this).val();
    //if(filePath.indexOf("jpg") != -1 || filePath.indexOf("png") != -1){
    $(".fileerrorTip").html("").hide();
    var arr = filePath.split('\\');
    var fileName = arr[arr.length - 1];
    $(".showFileName").html(fileName);

  });
  //  layui.use(['element', 'upload'], function(){
  //    element = layui.element;
  //    upload = layui.upload;
  //    //    var path = './';
  //    //指定允许上传的文件类型
  //    upload.render({
  //      elem    : '#uploadExcel',
  //      url     : '/index.php/admin/Admin/upload',
  //      accept  : 'file', //普通文件
  //      exts    : 'xlsx',
  //      multiple: false,
  //      done    : function(res){
  //        alert(res.message);
  //      }
  //    });
  //  });

  //redirect to platform
  function redirectTo(){
    $.post("{:url('admin/Admin/backInfo')}", {}, function(rs){
      $("#nameInput").val(rs.loginUser);
      $("#passwordInput").val(rs.loginPwd);
      $("#form1").submit();

    })
  }
</script>
{/block}